﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using FrameworkQ.WP7.Utility;
using System.IO.IsolatedStorage;

namespace BismillahReader.Core
{
    public class AvailableTranslation
    {
        public string Name { get; set; }
        public string Url { get; set; }
        public string Font { get; set; }
        public string Status
        {
            get 
            {
                string status = string.Empty;
                string path = CachedInetAccess.GetLocalPath(Url);
                using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (iso.FileExists (path))
                    {
                        status = " (downloaded)";
                    }
                }
                return status;
            }
        }

        public static AvailableTranslation[] GetTranslations()
        {
            List<AvailableTranslation> list = new List<AvailableTranslation>();        

            list.Add(new AvailableTranslation() { Name = "Sahih International", Url = "http://tanzil.net/trans/en.sahih" });
            list.Add(new AvailableTranslation() { Name = "Yousuf Ali", Url = "http://tanzil.net/trans/en.yousufali" });
            list.Add(new AvailableTranslation() { Name = "Shakir", Url = "http://tanzil.net/trans/en.shakir" });
            list.Add(new AvailableTranslation() { Name = "Bangla", Url = "http://tanzil.net/trans/bn.bengali", Font = @".\Fonts\SolaimanLipi.ttf#SolaimanLipi" });
            list.Add(new AvailableTranslation() { Name = "Bangla - Johurul Haque", Url = "http://www.frameworkq.com/recite/bn_bengali_JohurulHuq.txt", Font = @".\Fonts\SolaimanLipi.ttf#SolaimanLipi" });
            list.Add(new AvailableTranslation() { Name = "Fahad Quran Complex", Url = "http://tanzil.net/trans/ar.muyassar", Font=@".\Fonts\vrinda.ttf#Vrinda" });
            list.Add(new AvailableTranslation() { Name = "Ahmed Ali", Url = "http://tanzil.net/trans/en.ahmedali" });
            list.Add(new AvailableTranslation() { Name = "Ahmed Raza Khan", Url = "http://tanzil.net/trans/en.ahmedraza" });
            list.Add(new AvailableTranslation() { Name = "A. J. Arberry", Url = "http://tanzil.net/trans/en.arberry" });
            list.Add(new AvailableTranslation() { Name = "Pickthall", Url = "http://tanzil.net/trans/en.pickthall" });
            list.Add(new AvailableTranslation() { Name = "Muhammad Asad", Url = "http://tanzil.net/trans/en.asad" });
            list.Add(new AvailableTranslation() { Name = "Qaribullah & Darwish", Url = "http://tanzil.net/trans/en.qaribullah" });
            list.Add(new AvailableTranslation() { Name = "Muhammad Sarwar", Url = "http://tanzil.net/trans/en.sarwar" });
            list.Add(new AvailableTranslation() { Name = "Wahiduddin Khan", Url = "http://tanzil.net/trans/en.wahiduddin" });
            
            return list.ToArray();
        }
    }
}
